﻿using System.ComponentModel;
using System.Drawing.Design;
using System.Windows.Forms;

namespace CornerBowl.Forms
{    
    public class MultiLineTextBoxEditor : UITypeEditor
    {
        public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
        {
            return System.Drawing.Design.UITypeEditorEditStyle.Modal;
        }

        public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            MultiLineTextBoxForm frm = new MultiLineTextBoxForm((string)value);
            if (DialogResult.OK == frm.ShowDialog())
                return frm.Value;
            else
                return (string)value;
        }
    }
}
